package org.csie.jimms.java.example;

import org.json.JSONObject;

public class Server {
	
	public static void main(String[] args) throws Exception {
		Server server = new Server();
		
		server.process("{type:MyObject, data:{name:jimmy,age:26,address:taiper}}");
	}
	
	private void process(String string) throws Exception {
		JSONObject json = new JSONObject(string);
		System.out.println(json.getString("type"));
		
		if (json.getString("type").equals("MyObject")) {
			MyObject obj = new MyObject(json.getJSONObject("data"));
			System.out.println(obj.toJSONString());
		}
	}
}
